package cn.gjxblog.thread.example.threadpool;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author gjx
 * @version v1.0
 * @Description
 * @date 2019/7/1 16:01
 */
@Slf4j
public class ThreadPoolExample2 {

    public static void main(String[] args) {
        ExecutorService executorService =
                Executors.newCachedThreadPool();

        for(int i = 0; i < 100; i++){
            executorService.execute(new Runnable() {
                @Override
                public void run() {
                    log.info("thread name-{}",Thread.currentThread().getName());
                }
            });
        }

        executorService.shutdown();
    }
}
